package com.ruoyi.business.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.BusChannelRealtimeValue;
import com.ruoyi.business.service.IBusChannelRealtimeValueService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 通道硬件实时值记录表Controller
 * 
 * @author asher
 * @date 2021-11-02
 */
@RestController
@RequestMapping("/business/channel_realtime_value")
public class BusChannelRealtimeValueController extends BaseController
{
    @Autowired
    private IBusChannelRealtimeValueService busChannelRealtimeValueService;

    /**
     * 查询通道硬件实时值记录表列表
     */
    @PreAuthorize("@ss.hasPermi('business:channel_realtime_value:list')")
    @GetMapping("/list")
    public TableDataInfo list(BusChannelRealtimeValue busChannelRealtimeValue)
    {
        startPage();
        List<BusChannelRealtimeValue> list = busChannelRealtimeValueService.selectBusChannelRealtimeValueList(busChannelRealtimeValue);
        return getDataTable(list);
    }

    /**
     * 导出通道硬件实时值记录表列表
     */
    @PreAuthorize("@ss.hasPermi('business:channel_realtime_value:export')")
    @Log(title = "通道硬件实时值记录表", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(BusChannelRealtimeValue busChannelRealtimeValue)
    {
        List<BusChannelRealtimeValue> list = busChannelRealtimeValueService.selectBusChannelRealtimeValueList(busChannelRealtimeValue);
        ExcelUtil<BusChannelRealtimeValue> util = new ExcelUtil<BusChannelRealtimeValue>(BusChannelRealtimeValue.class);
        return util.exportExcel(list, "通道硬件实时值记录表数据");
    }

    /**
     * 获取通道硬件实时值记录表详细信息
     */
    @PreAuthorize("@ss.hasPermi('business:channel_realtime_value:query')")
    @GetMapping(value = "/{recordId}")
    public AjaxResult getInfo(@PathVariable("recordId") Long recordId)
    {
        return AjaxResult.success(busChannelRealtimeValueService.selectBusChannelRealtimeValueByRecordId(recordId));
    }

    /**
     * 新增通道硬件实时值记录表
     */
    @PreAuthorize("@ss.hasPermi('business:channel_realtime_value:add')")
    @Log(title = "通道硬件实时值记录表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BusChannelRealtimeValue busChannelRealtimeValue)
    {
        return toAjax(busChannelRealtimeValueService.insertBusChannelRealtimeValue(busChannelRealtimeValue));
    }

    /**
     * 修改通道硬件实时值记录表
     */
    @PreAuthorize("@ss.hasPermi('business:channel_realtime_value:edit')")
    @Log(title = "通道硬件实时值记录表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BusChannelRealtimeValue busChannelRealtimeValue)
    {
        return toAjax(busChannelRealtimeValueService.updateBusChannelRealtimeValue(busChannelRealtimeValue));
    }

    /**
     * 删除通道硬件实时值记录表
     */
    @PreAuthorize("@ss.hasPermi('business:channel_realtime_value:remove')")
    @Log(title = "通道硬件实时值记录表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{recordIds}")
    public AjaxResult remove(@PathVariable Long[] recordIds)
    {
        return toAjax(busChannelRealtimeValueService.deleteBusChannelRealtimeValueByRecordIds(recordIds));
    }
}
